Road Class Reference

#include <Road.h>

List of all members.

Public Member Functions

 Road (RoadType theType)
 ~Road ()
osg::Vec3 calculateCatmull (osg::Vec3 A, osg::Vec3 B, osg::Vec3 C, osg::Vec3 D, double t)
void setPoints (void)
void addDots ()
void addLines (void)
void addNewPoint (osg::Vec3 pos)
string * returnTextName ()
void geometryInitialize ()
void setWidthAndHeight ()

Private Attributes

RoadType type
float width
float length
osg::Vec3 controlPointArray [MaxNUMPOINTS]
osg::Vec3Array * verts
int numControlPoints
int numPoints
int controlPointsIndex
osg::ref_ptr< osg::Group > dotRoot
osg::ref_ptr< osg::Group > lineRoot
osg::ref_ptr< LinearConstraint > dc

Friends

class RoadMap


Detailed Description

Road is the seperate part of the RoadMap which has a fixed width and lane number, RoadMap ise eklenen Road'lari bir vector objesinde tutan kapsayici class theRoadMap is a global object of type RoadMap. The only object used in the project is this one. The variable is inialized as theRoadMap = new RoadMap();. A new kind of a Road object is created by giving an appropriate enumaration type in the constructor. RoadType meaning is as follows: TWO_HALFHALF_HALFHALF: TWO: determines the number of line count of the road. one line divides the road to two lanes. Other determines the type of the lines(full or half lines).

Definition at line 14 of file Road.h.


Constructor & Destructor Documentation

Road::Road (  RoadType  theType  ) 
 

constructor takes the type as argument

Definition at line 7 of file Road.cpp.

References controlPointsIndex, dc, dotRoot, lineRoot, numControlPoints, numPoints, setWidthAndHeight(), type, and verts.

Road::~Road (   )  [inline]
 

Definition at line 83 of file Road.h.


Member Function Documentation

void Road::addDots (   ) 
 

Adds the dot geode to the dotRoot

Definition at line 125 of file Road.cpp.

References controlPointArray, dotRoot, and numControlPoints.

Referenced by addNewPoint().

void Road::addLines (  void   ) 
 

Adss the lines geode to the lineRoot

Definition at line 84 of file Road.cpp.

References lineRoot, numPoints, and verts.

Referenced by addNewPoint().

void Road::addNewPoint (  osg::Vec3  pos  ) 
 

Puts the argumen into the controlPointArray and calls the following respectively: addDots addLines

Parameters:
pos is the point to be added

Definition at line 169 of file Road.cpp.

References addDots(), addLines(), controlPointArray, numControlPoints, and setPoints().

osg::Vec3 Road::calculateCatmull (  osg::Vec3  A,
osg::Vec3  B,
osg::Vec3  C,
osg::Vec3  D,
double  t
) 
 

Given four points the in between points are calculated.

Parameters:
A is the first point.
B is the second point.
C is the third point.
D is the final point.
t determines the frequency of the point adding.

Definition at line 43 of file Road.cpp.

Referenced by setPoints().

void Road::geometryInitialize (   ) 
 

sets dc's width height and verts variables.

Definition at line 194 of file Road.cpp.

References dc, length, returnTextName(), verts, and width.

string * Road::returnTextName (   ) 
 

Returns:
The texture file name according to the the type of the road object

Definition at line 181 of file Road.cpp.

References ONE_HALF, TWO_HALFHALF_HALFHALF, and type.

Referenced by geometryInitialize().

void Road::setPoints (  void   ) 
 

When a new control point is added this function is called

Definition at line 65 of file Road.cpp.

References calculateCatmull(), controlPointArray, controlPointsIndex, numControlPoints, numPoints, and verts.

Referenced by addNewPoint().

void Road::setWidthAndHeight (   ) 
 

according to the type of Road this function determines the width and length (for texturing purposes) of Road.

Definition at line 19 of file Road.cpp.

References length, ONE_HALF, TWO_HALFHALF_HALFHALF, type, and width.

Referenced by Road().


Friends And Related Function Documentation

friend class RoadMap [friend]
 

Definition at line 16 of file Road.h.


Member Data Documentation

osg::Vec3 Road::controlPointArray[MaxNUMPOINTS] [private]
 

control points for the Roads needed for catmull rom splines

Definition at line 37 of file Road.h.

Referenced by addDots(), addNewPoint(), and setPoints().

int Road::controlPointsIndex [private]
 

while calculating the spline points, this variable holds from where in the controlPointArray array to send to calculateCatmull

Definition at line 59 of file Road.h.

Referenced by Road(), and setPoints().

osg::ref_ptr<LinearConstraint> Road::dc [private]
 

conjuction of two roads is handled via this variable

Definition at line 75 of file Road.h.

Referenced by geometryInitialize(), and Road().

osg::ref_ptr<osg::Group> Road::dotRoot [private]
 

a node that holds control points in this road object

Definition at line 65 of file Road.h.

Referenced by addDots(), and Road().

float Road::length [private]
 

length of a linear feature

Definition at line 31 of file Road.h.

Referenced by geometryInitialize(), and setWidthAndHeight().

osg::ref_ptr<osg::Group> Road::lineRoot [private]
 

a node that holds lines draw between control points in this road object

Definition at line 70 of file Road.h.

Referenced by addLines(), and Road().

int Road::numControlPoints [private]
 

holds the number of the control points added uptonow

Definition at line 48 of file Road.h.

Referenced by addDots(), addNewPoint(), Road(), and setPoints().

int Road::numPoints [private]
 

holds the number of the points on the spline uptonow

Definition at line 53 of file Road.h.

Referenced by addLines(), Road(), and setPoints().

RoadType Road::type [private]
 

the type of the enum determines the road texture and size..

Definition at line 23 of file Road.h.

Referenced by returnTextName(), Road(), and setWidthAndHeight().

osg::Vec3Array* Road::verts [private]
 

holds all the points calculated on the spline

Definition at line 42 of file Road.h.

Referenced by addLines(), geometryInitialize(), Road(), and setPoints().

float Road::width [private]
 

width of a linear feature

Definition at line 27 of file Road.h.

Referenced by geometryInitialize(), and setWidthAndHeight().


The documentation for this class was generated from the following files:
Generated on Sun May 28 18:54:14 2006 for TraffEdu by  doxygen 1.4.6-NO